
CROSS_COMPILE = 
AS		= $(CROSS_COMPILE)as
LD		= $(CROSS_COMPILE)ld
CC		= $(CROSS_COMPILE)gcc
CPP		= $(CC) -E
AR		= $(CROSS_COMPILE)ar
NM		= $(CROSS_COMPILE)nm

STRIP		= $(CROSS_COMPILE)strip
OBJCOPY		= $(CROSS_COMPILE)objcopy
OBJDUMP		= $(CROSS_COMPILE)objdump

export AS LD CC CPP AR NM
export STRIP OBJCOPY OBJDUMP


CFLAGS := -Wall -O2 -g
CFLAGS += -I ./inc 
CFLAGS += -I  /usr/include/
CFLAGS += -I  /usr/include/alsa/
CFLAGS += -I  /usr/local/include/
CFLAGS += -I  /usr/local/include/libavutil
CFLAGS += -I  /usr/local/include/libavcodec
CFLAGS += -I  /usr/local/include/libdrm
CFLAGS += -I  /usr/local/include/rockchip
CFLAGS += -I  /usr/local/include/SDL2
CFLAGS += -I  /usr/local/include/freetype2
CFLAGS += -I  /usr/local/include/cjson/
CFLAGS += -I  /usr/local/include/curl/



#make install 安装的 libavxxx.pc 文件移到默认pkg-config 目录中。
#make install   libavxxxx.pc 文件 在/usr/local/lib/pkgconfig  
#cp /usr/local/lib/pkgconfig/*  /usr/share/pkgconfig/ 拷贝。


LDFLAGS := -ldl -lm -lpthread
LDFLAGS += -L /usr/lib
LDFLAGS += -L /usr/local/lib
LDFLAGS += -lavfilter   
LDFLAGS += -ldrm_rockchip -ldrm
LDFLAGS += -lrockchip_mpp
LDFLAGS += -lSDL2
LDFLAGS += -lasound
LDFLAGS += -lfreetype
LDFLAGS += -lcjson
LDFLAGS += -lcurl
LDFLAGS += -lavformat -lavcodec -lswresample 
LDFLAGS += -lavutil -lavdevice -lswscale
LDFLAGS += -ljpeg

export CFLAGS LDFLAGS

TOPDIR := $(shell pwd)
export TOPDIR

TARGET := rkmpp_player

obj-y +=  lib_alsa/ 
obj-y +=  lib_bmp/ 
obj-y +=  lib_drm/  
obj-y +=  lib_ffmpeg/ 
obj-y +=  lib_jpeg/ 
obj-y +=  lib_mpp/
obj-y +=  lib_png/ 
obj-y +=  lib_rga/  
obj-y +=  lib_sdl2/
obj-y +=  public/ 
obj-y +=  key_event/
obj-y +=  platform/ 
obj-y +=  lib_gui/ 
obj-y +=  desktop/
obj-y +=  net/
obj-y +=  test/


obj-y +=  main.o 


all : start_recursive_build $(TARGET)
	@echo $(TARGET) has been built!

start_recursive_build:
	make -C ./ -f $(TOPDIR)/Makefile.build

$(TARGET) : built-in.o
	$(CC)  -o $(TARGET) built-in.o $(LDFLAGS)

clean:
	rm -f $(shell find -name "*.o")
	rm -f $(TARGET)

distclean:
	rm -f $(shell find -name "*.o")
	rm -f $(shell find -name "*.d")
	rm -f $(TARGET)
	